package com.yundasys.lab12java.java8;

/**
 * @PACKAGE_NAME: com.yundasys.lab12java.java8
 * @NAME: Pizza
 * @USER: jiangta
 * @DATE: 2021/10/15
 * @TIME: 9:26 上午
 * @PROJECT_NAME: springboot-labs
 */
public class Pizza {
    
    private PizzaStatus pizzaStatus;
    public boolean isDeliverable() {
        return getPizzaStatus() == PizzaStatus.READY;
    }

    public PizzaStatus getPizzaStatus() {
        return pizzaStatus;
    }

    public void setPizzaStatus(PizzaStatus pizzaStatus) {
        this.pizzaStatus = pizzaStatus;
    }

    public void deliver() {
        if (isDeliverable()) {
            PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy()
                    .deliver(this);
            this.setPizzaStatus(PizzaStatus.DELIVERED);
        }
    }
}
